namespace CRM.DataAccess.Entities
{
    using System;
    using System.Data.Entity;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;

    public partial class Entities : DbContext
    {
        public Entities()
            : base("name=Entities")
        {
        }

        public virtual DbSet<ACCOUNT> ACCOUNTS { get; set; }
        public virtual DbSet<APPOINTMENT> APPOINTMENTS { get; set; }
        public virtual DbSet<CARRIER> CARRIERs { get; set; }
        public virtual DbSet<CONTACT_STATUS> CONTACT_STATUS { get; set; }
        public virtual DbSet<CONTACT> CONTACTS { get; set; }
        public virtual DbSet<CURRENCy> CURRENCIES { get; set; }
        public virtual DbSet<DELIVERY_NOTE> DELIVERY_NOTE { get; set; }
        public virtual DbSet<DEPOSIT_COLLECTIONS> DEPOSIT_COLLECTIONS { get; set; }
        public virtual DbSet<DESCRIPTION_DETAILS> DESCRIPTION_DETAILS { get; set; }
        public virtual DbSet<EMAIL_TEMPLATE> EMAIL_TEMPLATE { get; set; }
        public virtual DbSet<EMAIL> EMAILS { get; set; }
        public virtual DbSet<GROUP> GROUPS { get; set; }
        public virtual DbSet<INVOICE_STATUS> INVOICE_STATUS { get; set; }
        public virtual DbSet<INVOICE> INVOICES { get; set; }
        public virtual DbSet<ITEM_DETAIL> ITEM_DETAIL { get; set; }
        public virtual DbSet<ITEM> ITEMS { get; set; }
        public virtual DbSet<LEAD_SOURCE> LEAD_SOURCE { get; set; }
        public virtual DbSet<LEAD> LEADS { get; set; }
        public virtual DbSet<LOYALTY> LOYALTies { get; set; }
        public virtual DbSet<ORGANIZATION_INDUSTRY> ORGANIZATION_INDUSTRY { get; set; }
        public virtual DbSet<ORGANIZATION_RATING> ORGANIZATION_RATING { get; set; }
        public virtual DbSet<ORGANIZATION_TYPE> ORGANIZATION_TYPE { get; set; }
        public virtual DbSet<ORGANIZATION> ORGANIZATIONS { get; set; }
        public virtual DbSet<PAYMENT_COLLECTIONS> PAYMENT_COLLECTIONS { get; set; }
        public virtual DbSet<PROCESS_ORDERS> PROCESS_ORDERS { get; set; }
        public virtual DbSet<PRODUCT_CATEGORY> PRODUCT_CATEGORY { get; set; }
        public virtual DbSet<PRODUCT_MANUFACTURER> PRODUCT_MANUFACTURER { get; set; }
        public virtual DbSet<PRODUCT_USAGE_UNIT> PRODUCT_USAGE_UNIT { get; set; }
        public virtual DbSet<PRODUCT> PRODUCTS { get; set; }
        public virtual DbSet<QUOTATION_ISSUES> QUOTATION_ISSUES { get; set; }
        public virtual DbSet<QUOTE_STAGE> QUOTE_STAGE { get; set; }
        public virtual DbSet<QUOTE> QUOTES { get; set; }
        public virtual DbSet<ROLE> ROLES { get; set; }
        public virtual DbSet<SALES_ORDER> SALES_ORDER { get; set; }
        public virtual DbSet<SALUTATION> SALUTATIONs { get; set; }
        public virtual DbSet<sysdiagram> sysdiagrams { get; set; }
        public virtual DbSet<TERMS_AND_CONDITIONS> TERMS_AND_CONDITIONS { get; set; }
        public virtual DbSet<USER> USERS { get; set; }
        public virtual DbSet<USERS_LOGINS> USERS_LOGINS { get; set; }
        public virtual DbSet<USERS_PASSWORD_HISTORY> USERS_PASSWORD_HISTORY { get; set; }
        public virtual DbSet<CONTACT_DETAIL> CONTACT_DETAIL { get; set; }
        public virtual DbSet<INVOICE_DETAIL> INVOICE_DETAIL { get; set; }
        public virtual DbSet<ITEM_DETAILS> ITEM_DETAILS { get; set; }
        public virtual DbSet<ORGANIZATION_DETAIL> ORGANIZATION_DETAIL { get; set; }
        public virtual DbSet<ORGANIZATION_NOT_SEND_INVOICE_QUOTE> ORGANIZATION_NOT_SEND_INVOICE_QUOTE { get; set; }
        public virtual DbSet<PRODUCT_DETAIL> PRODUCT_DETAIL { get; set; }
        public virtual DbSet<QUOTE_DETAIL> QUOTE_DETAIL { get; set; }
        public virtual DbSet<USER_DETAIL> USER_DETAIL { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<CONTACT>()
                .Property(e => e.STATUS_FINAL_STEP)
                .IsFixedLength();

            modelBuilder.Entity<EMAIL>()
                .Property(e => e.MESSAGE_ID)
                .IsUnicode(false);

            modelBuilder.Entity<GROUP>()
                .Property(e => e.GROUP_NAME)
                .IsFixedLength();

            modelBuilder.Entity<GROUP>()
                .Property(e => e.DESCRIPTION)
                .IsFixedLength();

            modelBuilder.Entity<ROLE>()
                .Property(e => e.ROLE_NAME)
                .IsUnicode(false);

            modelBuilder.Entity<USER>()
                .Property(e => e.SERIAL_NUMBER)
                .IsFixedLength();

            modelBuilder.Entity<CONTACT_DETAIL>()
                .Property(e => e.STATUS_FINAL_STEP)
                .IsFixedLength();

            modelBuilder.Entity<CONTACT_DETAIL>()
                .Property(e => e.STAGE)
                .IsUnicode(false);

            modelBuilder.Entity<USER_DETAIL>()
                .Property(e => e.ROLE_NAME)
                .IsUnicode(false);

            modelBuilder.Entity<USER_DETAIL>()
                .Property(e => e.GROUP_NAME)
                .IsFixedLength();

            modelBuilder.Entity<USER_DETAIL>()
                .Property(e => e.SERIAL_NUMBER)
                .IsFixedLength();
        }
    }
}
